home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / northc / northc1.lzh / include / limits.h < prev    next >
C/C++ Source or Header  |  1990-08-30  |  1KB  |  46 lines

  1. /*
  2.  *    LIMITS.H
  3.  */
  4.  
  5. #ifndef    LIMITS_H
  6. #define    LIMITS_H
  7.  
  8. #define    PATHSIZE    (128)        /* maximum pathname length */
  9.  
  10. #define    BITSPERBYTE    8
  11.  
  12. /* constants with only the high bit set */
  13. #define    HIBITS    ((short) (1 << (BITSPERBYTE * sizeof(short) - 1)))
  14. #define    HIBITI    ((int) (1 << (BITSPERBYTE * sizeof(int) - 1)))
  15. #define    HIBITL    ((long) (1L << (BITSPERBYTE * sizeof(long) - 1)))
  16.  
  17. /* largest value for each type */
  18. #define    MAXSHORT    ((short) (~HIBITS))
  19. #define    MAXINT        ((int) (~HIBITI))
  20. #define    MAXLONG        ((long) (~HIBITL))
  21.  
  22. /* smallest value for each type (assumes 2's complement representation) */
  23. #define    MINSHORT    HIBITS
  24. #define    MININT        HIBITI
  25. #define    MINLONG        HIBITL
  26.  
  27. /* similar #defines for ANSI compatibility */
  28. #define    CHAR_BIT    BITSPERBYTE
  29. #define    CHAR_MAX    SCHAR_MAX
  30. #define    CHAR_MIN    SCHAR_MIN
  31. #define    INT_MAX        MAXINT
  32. #define    INT_MIN        MININT
  33. #define    LONG_MAX    MAXLONG
  34. #define    LONG_MIN    MINLONG
  35. #define MB_LEN_MAX    (1)
  36. #define    SCHAR_MAX    (127)
  37. #define    SCHAR_MIN    (-128)
  38. #define    SHRT_MAX    MAXSHORT
  39. #define    SHRT_MIN    MINSHORT
  40. #define    UCHAR_MAX    ~((unsigned char) 0)
  41. #define    UINT_MAX    ~((unsigned int) 0)
  42. #define    ULONG_MAX    ~((unsigned long) 0)
  43. #define    USHRT_MAX    ~((unsigned short) 0)
  44.  
  45. #endif LIMITS_H
  46.